package com.zhiyou100.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.junit.Test;

public class FormatDate{
	@Test
	public void formatDate() throws ParseException {
		Date date = new Date();
		System.out.println("当前电脑时间:"+date);
		String pattern = "yyyy-MM-dd HH:mm:ss";
		SimpleDateFormat sdf = new SimpleDateFormat(pattern); 
		String format = sdf.format(date);
		System.out.println("转换格式后的当前日期时间:"+format);
		
		Date parse = sdf.parse(format);
		System.out.println("格式转换后又解析的日期:"+parse);
		
//		System.out.println("----"+sdf.parse("1997-12-23").getTime());
		
//		return format;
		
	}

}
